<!doctype HTML>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<div>
    <ol>
        <li>First list item
            <ul>
                <li id="ul_list_item">Nested list item</li>
            </ul>
        </li>
    </ol>
</div>
<div>
    <ul>
        <li>First list item
            <ol>
                <li id="ol_list_item">Nested list item</li>
            </ol>
        </li>
    </ul>
</div>
<script>
test(function() {
    document.getSelection().removeAllRanges();
    var range = document.createRange();
    range.selectNode(document.getElementById('ul_list_item'));
    document.getSelection().addRange(range);

    assert_equals(document.queryCommandState('insertOrderedList'), false);
    assert_equals(document.queryCommandState('insertUnorderedList'), true);
}, 'run queryCommandState() on the unordered list item');

test(function() {
    document.getSelection().removeAllRanges();
    var range = document.createRange();
    range.selectNode(document.getElementById('ol_list_item'));
    document.getSelection().addRange(range);

    assert_equals(document.queryCommandState('insertOrderedList'), true);
    assert_equals(document.queryCommandState('insertUnorderedList'), false);
}, 'run queryCommandState() on the ordered list item');
</script>
